]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Allow disabling touchpad workspace switch action
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 20 Mar 2019 17:03:27 +0000 (17:03 +0000)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 11 Apr 2019 17:00:17 +0000 (17:00 +0000)
Just like actual ClutterActions, it can make sense to temporarily
disable the touchpad action, so add an appropriate property.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/516

js/ui/windowManager.js

index ea9493d6fc1af88ef133ba2017fdf40cc208253c..683a876f13e738fdc975ff4898ffb51d14bbcecf 100644 (file)
@@ -459,10 +459,24 @@ var TouchpadWorkspaceSwitchAction = class {
     constructor(actor) {
         this._dx = 0;
         this._dy = 0;
+        this._enabled = true;
         actor.connect('captured-event', this._handleEvent.bind(this));
        this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
     }
 
+    get enabled() {
+        return this._enabled;
+    }
+
+    set enabled(enabled) {
+        if (this._enabled == enabled)
+            return;
+
+        this._enabled = enabled;
+        if (!enabled)
+            this.emit('cancel');
+    }
+
     _checkActivated() {
         let dir;
 
@@ -493,6 +507,9 @@ var TouchpadWorkspaceSwitchAction = class {
         if ((allowedModes & Main.actionMode) == 0)
             return Clutter.EVENT_PROPAGATE;
 
+        if (!this._enabled)
+            return Clutter.EVENT_PROPAGATE;
+
         if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
             let [dx, dy] = event.get_gesture_motion_delta();